<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="renderer" content="webkit">
<meta name="force-rendering" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<link rel="stylesheet" href="/static/layui/css/layui.css" media="all">
<link charset="utf-8" rel="stylesheet" type="text/css" href="/static/ali/ali.css" />
<link charset="utf-8" rel="stylesheet" type="text/css" href="/static/ali/home.css" />
<title>友利钱包账户中心</title>
<style type="text/css">
 .layui-table-view,.layui-table-view .layui-table,.layui-table-view .layui-table[lay-skin=line],.layui-table-header{border:0;}
.layui-table-view .layui-table th,.layui-table-view .layui-table td{height: 50px;}
.layui-table thead tr{background-color: #f6f6f6;color: rgba(0,0,0,.85);}
.layui-table tbody tr:hover,.layui-table-hover{background-color: #f6f6f6;transition: all .1s;-webkit-transition: all .1s;}
.layui-laypage .layui-laypage-curr .layui-laypage-em{background-color: #108ee9;}
.layui-table-cell .layui-table-link{color: #108ee9;}
.layui-table td, .layui-table th {font-size: 12px;}
</style>
</head>
<body>
	#include("common/header.html", site="home")

	<div class="content">
		<div class="content-wrapper">
			<div class="content-left">
				<div class="menu-title">账户中心</div>
				<div class="menu-group">
				#include("common/sider.html", site="order")
				</div>
			</div>
			<div class="content-right">
				<div class="main-title">交易明细</div>
				<div class="option-panel">
					<div class="toolbar layui-form">
						<div class="search-form">
							<div class="form-row">
								<div class="form-item">
									<div class="form-label">开始时间</div>
									<div class="form-value"><input name="createTimeStart" type="text" id="createTimeStart"></div>
								</div>
								<div class="form-item">
									<div class="form-label">结束时间</div>
									<div class="form-value"><input name="createTimeEnd" type="text" id="createTimeEnd"></div>
								</div>
								<div class="form-item">
									<div class="form-label">单号</div>
									<div class="form-value"><input name="orderNo" type="text"></div>
								</div>
							</div>
							<div class="form-row">
								<div class="form-item">
									<div class="form-label">交易对手</div>
									<div class="form-value"><input type="text" name="realName"></div>
								</div>
								<div class="form-item">
									<div class="form-label">金额起始</div>
									<div class="form-value"><input type="text" onkeyup='upperCase(this)' name="price_min" placeholder="￥"></div>
								</div>
								<div class="form-item">
									<div class="form-label">金额结束</div>
									<div class="form-value"><input type="text" onkeyup='upperCase(this)' name="price_max" placeholder="￥"></div>
								</div>
							</div>
							<div class="form-row">
								<div class="form-item">
									<div class="form-label">制单类型</div>
									<div class="form-value">
										<select name="bizType" lay-ignore>
											<option value="">-全部-</option>
											#for(item:bizTypeList)
											<option value="#(item.code)">#(item.name)</option>
											#end
										</select>
									</div>
								</div>
								<div class="form-item">
									<div class="form-label">状态</div>
									<div class="form-value">
										<select name="orderStatus" lay-ignore>
											<option value="">-全部-</option>
											<option value="TS">成功</option>
											<option value="TF">失败</option>
											<option value="IP">处理中</option>
										</select>
									</div>
								</div>
							</div>
							<div class="btn-area">
								<button class="form-btn form-btn-primary" lay-submit lay-filter="LAY-web-list-search">搜 索</button>
								<button style="display: none" class="form-btn form-btn-primary" lay-submit lay-filter="export">导出对账Excel表</button>
								<button class="form-btn form-btn-primary" lay-submit lay-filter="exportSheet">导出明细Excel表</button>
							</div>
						</div>
					</div>
					<div class="tab-container">
						<ul class="nav-tabs">
							<li class="#if(status=='all')active#end"><a href="">全部</a></li>
							#--
							<li class="#if(status=='create')active#end"><a href="">等待充值</a></li>
							<li class="#if(status=='pay')active#end"><a href="">充值完成</a></li>
							<li class="#if(status=='proc')active#end"><a href="">处理中</a></li>
							<li class="#if(status=='wait')active#end"><a href="">待审核</a></li>--#
						</ul>
					</div>

					<table id="LAY-web-list" lay-filter="LAY-web-list"></table>

				</div>
			</div>
		</div>
	</div>

	#include("common/footer.html")
<script src="/static/layui/layui.js"></script>
<script>
layui.config({
    base: '/static/fly/mods/'
  }).extend({
	  fly: 'index'
  }).use(['laydate', 'table', 'form', 'layer', 'order'], function(){
	var laydate = layui.laydate;
	//日期时间选择器
	laydate.render({
		elem: '#createTimeStart',
		theme: '#108ee9',
		type: 'datetime'
	});
	laydate.render({
		elem: '#createTimeEnd',
		theme: '#108ee9',
		type: 'datetime',
		ready: function(date){
			if(date.hours==0 && date.minutes==0 && date.seconds==0){
				this.dateTime.hours=23, this.dateTime.minutes=59, this.dateTime.seconds=59;
			}
		}
	});

   // 表格
   var table = layui.table, form = layui.form, $ = layui.$;

   //监听搜索
   form.on('submit(LAY-web-list-search)', function(data){
	   console.log(data.field);
     //执行重载
     table.reload('LAY-web-list', {
       where: data.field,
       page: {curr: 1}
     });
   });

   //export
    //监听搜索
    form.on('submit(export)', function(data){
        console.log(data.field);
        layer.msg("正在导出Excel表...");
        $.ajax({
            type:"GET",
            url:"/customer/order/report",
            data:data.field,
            dataType: "JSON",
            success: function(data) {
                //alert(JSON.stringify(data));
                if(data.code==0){
                    window.location.href= data.msg;
                }else {
                    alert("导出错误:" + JSON.stringify(data) );
				}
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert("网络错误");
            }
		});
        //执行重载
        table.reload('LAY-web-list', {
            where: data.field,
            page: {curr: 1}
        });
    });



    form.on('submit(exportSheet)', function(data){
        console.log(data.field);
        layer.msg("正在导出成功交易明细Excel表...");
        $.ajax({
            type:"GET",
            url:"/customer/order/reportSheet",
            data:data.field,
            dataType: "JSON",
            success: function(data) {
                //alert(JSON.stringify(data));
                if(data.code==0){
                    window.location.href= data.msg;
                }else {
                    alert("导出错误:" + JSON.stringify(data) );
                }
            },
            error: function(XMLHttpRequest, textStatus, errorThrown) {
                alert("网络错误");
            }
        });
        //执行重载
        table.reload('LAY-web-list', {
            where: data.field,
            page: {curr: 1}
        });
    });

 });


function upperCase(obj){//用户只能输入正负数与小数
    if(isNaN(obj.value) && !/^-$/.test(obj.value)){
        obj.value="";
    }
    if(!/^[+-]?\d*\.{0,1}\d{0,1}$/.test(obj.value)){
        obj.value=obj.value.replace(/\.\d{2,}$/,obj.value.substr(obj.value.indexOf('.'),3));
    }
}

 </script>
</body>
</html>
